package test.threadpool;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class App {
	
	public static void main(String[] args) {
//		ExecutorService pool = Executors.newSingleThreadExecutor();
//		ExecutorService pool = Executors.newFixedThreadPool(3);
//		ExecutorService pool = Executors.newCachedThreadPool();
//		for(int i=0;i<10;i++) {
//			pool.execute(new MyThread());
//		}
//		pool.shutdown();
		ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(2);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        exec.scheduleAtFixedRate(new MyThread(), 1000, 5000, TimeUnit.MILLISECONDS);
        exec.scheduleAtFixedRate(new MyThread(), 1000, 2000, TimeUnit.MILLISECONDS);
	}

}
